<template>
  <div class="bg-white border-t border-gray-100">
    <!-- 搜索框 -->
    <div class="px-4 py-3">
      <van-search
        v-model="searchValue"
        placeholder="搜索"
        shape="round"
        @search="$emit('search', searchValue)"
      />
    </div>

    <!-- 全选区域 -->
    <div class="px-4 py-2 flex items-center border-t border-gray-100">
      <van-checkbox
        :model-value="allSelected"
        @change="handleSelectAll"
      >
        全选
      </van-checkbox>
      <span class="ml-4 text-sm text-gray-500">
        已选择: {{ selectedCount }}人
      </span>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

defineProps({
  allSelected: Boolean,
  selectedCount: Number
});

const searchValue = ref('');
const emit = defineEmits(['search', 'select-all']);

function handleSelectAll(checked) {
  emit('select-all', checked);
}
</script> 